Skip to content

Fixes image-datetime (de)-serialization#14

Merged
cjackett merged 6 commits intocsiro-fair:devfrom
GermanHydrogen:fix/datetime-format
Apr 7, 2026
Merged

Fixes image-datetime (de)-serialization#14
cjackett merged 6 commits intocsiro-fair:devfrom
GermanHydrogen:fix/datetime-format

Conversation

@GermanHydrogen
Copy link
Copy Markdown
Contributor

This PR changes the default image-datetime (de)-serialization to be aware of the image-datetime-format. The implementation for this seems quite complex, since the image-datetime-format in the header is inherited as a default to items of image-set-items. It is also inherited from the first entry of a video item to all consecutive items.

Fixes #13

@GermanHydrogen GermanHydrogen changed the base branch from main to dev July 1, 2025 09:57
cjackett added 3 commits April 7, 2026 11:40
Previously, `_check_image_item` raised a ValueError when the stored `image-datetime` string did not match `image-datetime-format`, breaking existing iFDO files where these fields were inconsistent — a common case when files were produced by tools that set `image-datetime-format` to describe the intended serialization format while Pydantic serialized the datetime as ISO 8601 regardless. The validator now catches parse failures and leaves the string unchanged, allowing Pydantic's own ISO 8601 handling to take over; tests are updated to assert this fallback behaviour.
Renamed the misspelled `check_datatime_format` ("data" + "time") to `check_datetime_format` ("date" + "time") across all call sites and exports, and corrected the companion validator method `_validate_image_datatime` to `_validate_image_datetime`.
Datetime format-aware serialization and deserialization constitutes new behaviour rather than a pure bug fix, as datetimes are now always loaded as UTC-aware objects and written in the spec-defined space-separated format instead of ISO 8601, warranting a minor version bump.
@cjackett cjackett force-pushed the fix/datetime-format branch from f482ad4 to 9ba951a Compare April 7, 2026 02:33
@cjackett cjackett merged commit 865a49f into csiro-fair:dev Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

image-datetime output format

2 participants